home *** CD-ROM | disk | FTP | other *** search
- Path: nntp-hub.barrnet.net!biosys!paralysys
- From: nasser@paralysys (Nasser Abbasi)
- Newsgroups: comp.lang.c++
- Subject: Re: Which is better????
- Message-ID: <nhu3z4lge3.fsf@paralysys>
- Date: 1 Apr 96 04:25:40 GMT
- References: <3155559E.7120@dial.pipex.com>
- <greg-2403961302300001@ts10-3.slip.uwo.ca>
- Sender: news@biosys.apldbio.COM
- Organization: Applied BioSystems
- In-reply-to: greg@ohs.uwo.ca's message of 24 Mar 96 18:02:30 GMT
- X-Newsreader: Gnus v5.1
-
- In article <greg-2403961302300001@ts10-3.slip.uwo.ca> greg@ohs.uwo.ca (Greg Chapman) writes:
-
- In article <3155559E.7120@dial.pipex.com>, gs94@dial.pipex.com wrote:
-
- >I would prefer to use the faster method as I am iterating over some functions
- >several times passing megabytes of data (not all at once, in chunks of a few
- >dozen bytes at a time)
-
- Generally, pass a pointer if the data is longer then 4 bytes.
-
-
-
- Always pass by reference when at all possible.
-
- With C++, direct use of pointer use is very much
- less needed than with C sinc one can use refernces
- now.
-
- If the object being passed is not to be modified
- inside the called function, then use the const modifier,
- this will make sure the compiler will check the
- object is not being changed in the called function.
-
- ALso remember than passing by value means the creation
- of temporary object (i..e constructors, destructors
- for the objects called etc..), but passing by refernce with
- const modifier will not cause this overhead.
-
- Nasser
-
-
-
-